package criptosuma.formulation;

import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import es.deusto.ingenieria.is.csp.formulation.Constraint;
import es.deusto.ingenieria.is.csp.formulation.Variable;

public class CriptosumaXMLParser extends DefaultHandler 
{
	private List<String> operands;
	private String result;
	private List<Constraint<Integer>> constraints;
	private List<Variable<Integer>> variables;
	private char[][] operation;
	
	public CriptosumaXMLParser(String fileXML)
	{
		
	}
	
	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
	{
		if(qName.equalsIgnoreCase("puzzle"))
		{
			
		}
		
		if(qName.equalsIgnoreCase("operand"))
		{
			operands.add(attributes.getValue("word"));
		}
		
		if(qName.equalsIgnoreCase("result"))
		{
			result = attributes.getValue("word");
		}
	}
	
	private void processXML(String fileXML)
	{
		
	}
	
	private char[][] getLetters()
	{
		return null;
	}
	
	private void createVariablesAndConstraints()
	{
		
	}

	public List<Constraint<Integer>> getConstraints() 
	{
		return constraints;
	}

	public List<Variable<Integer>> getVariables() 
	{
		return variables;
	}

	public char[][] getOperation() 
	{
		return operation;
	}
	
	private Variable<Integer> letterToVar(char letter)
	{
		return null;
	}

	private List<Integer> createLetterDomain()
	{
		ArrayList<Integer> aux = new ArrayList<Integer>();
		for(int i=0;i<=9;i++)
			aux.add(i);
		return aux;
	}
	
	private List<Integer> createCarryDomain()
	{
		ArrayList<Integer> aux = new ArrayList<Integer>();
		for(int i=0;i<=9;i++)
			aux.add(i);
		return aux;
	}
}
